package 每日一题;

/**
 * @author 会玩的洋洋
 * https://leetcode-cn.com/problems/number-of-rectangles-that-can-form-the-largest-square/
 */
public class _1725_可以形成最大正方形的矩形数目 {
    public int countGoodRectangles(int[][] rectangles) {
        int maxLen = 0;
        int ans = 0;
        for (int[] rectangle : rectangles) {
            int temp = Math.min(rectangle[0], rectangle[1]);
            if (temp == maxLen) {
                ans++;
            } else if (temp > maxLen) {
                ans = 1;
                maxLen = temp;
            }
        }
        return ans;
    }
}
